package com.ys.mapper.purchase;

import com.ys.entity.purchase.TcgDistribution;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
public interface PurchaseMapper {
    //20230301日改成根据1688商品ID与系统商品ID为主键删除相应数据
    int deleteDistributionByMap(Map<String, Object> params);

    int insertBatchDistribution(List<TcgDistribution> list);
    
    /*
     * 统计采购预约单的总预约金额
     */
    BigDecimal sumTotalAmountOfPurchaseAppoint(@Param("bid")String bid);

    /**
	 * 更新采购预约单与合同关联的数据
     * @param bid 预约采购单号
     * @return
     */
	public int updateTcgPurchaseAppointOrderProductComponentOfConstract(@Param("bid")String bid);

    /**
	 * 更新采购预约单与入库关联的数据
     * @param bid 预约采购单号
     * @return
     */
	public int updateTcgPurchaseAppointOrderProductComponentOfStorage(@Param("bid")String bid);

	/*
	 * 删除发票登记单子表数据
	 */
	public void deleteBatchTcgInvoiceRegistByBid(@Param("bid")String bid);
	
	/**
	 * 计算母件采购单价
	 * @param itemId 预约采购单明细ID
	 * @return
	 */
	public BigDecimal sumParentSinglePriceByAppointOrderItemId(@Param("itemId")Long itemId);

}